package com.wenhai.configuration.metadata;

import com.wenhai.xiaomage.spring.ioc.overview.dependency.domain.User;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

/**
 * 基于 Java 注解 Spring IoC 容器元信息配置示例
 *
 * @author wenhai
 * @date   2021/4/6
 */
@ImportResource("classpath:/META-INF/dependency-lookup-context.xml")
@Import(User.class)
public class AnnotatedSpringIoCContainerMetadataConfigurationDemo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(AnnotatedSpringIoCContainerMetadataConfigurationDemo.class);
        context.refresh();
        System.out.println(context.getBeansOfType(User.class));
        context.close();
    }
}
